package com.kevin.jvm;

/**
 * @author kevin lau
 */
public class LoaderTest {

    public static void main(String[] args) throws Exception {
        Class<?> c1 = Demo.class;
        Class<?> c2 = new MyClassLoader("/Users/kevin/code/java/spring-boot-projects/spring-boot-concurrent/target/classes").loadClass("com.kevin.jvm.Demo");
        System.out.println("class name");
        System.out.println(c1.getName());
        System.out.println(c2.getName());
        System.out.println("classLoader name");
        System.out.println(c1.getClassLoader());
        System.out.println(c2.getClassLoader());
        Demo.val = 2;
        System.out.println("static value");
        System.out.println(c1.getDeclaredField("val").get(null));
        System.out.println(c2.getDeclaredField("val").get(null));
    }
}
